<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">
		<title>智慧公社 我的首页-每个人都有他存在的价值</title>
		<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
		<link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet">
		<link href="__PUBLIC__/css/animate.css" rel="stylesheet"  />
		<link rel="stylesheet" href="__PUBLIC__/css/index.css">
		<link href="__PUBLIC__/css/font-awesome.css"  rel="stylesheet" type="text/css">
		<link href="__PUBLIC__/css/iosOverlay.css"  rel="stylesheet" type="text/css">
		<script src="__PUBLIC__/js/jquery.js"></script>
		<script src="__PUBLIC__/js/headroom.js"></script>
		<script src="__PUBLIC__/js/jquery.snippet.min.js"></script>
		<script src="__PUBLIC__/js/bootstrap.min.js"></script>
		<script src="__PUBLIC__/js/jquery.pin.min.js"></script>
		<script src="__PUBLIC__/js/index.js"></script>
		<script src="__PUBLIC__/js/ZeroClipboard.min.js"></script>
		<script src="__PUBLIC__/js/bootstrap-wysiwyg.js"></script>
		<script src="__PUBLIC__/js/jquery.hotkeys.js"></script>
		<script src="__PUBLIC__/js/iosOverlay.js"></script>
		<script src="__PUBLIC__/js/spin.min.js"></script>
		<script>
			var url="{:U('Index/addArticle')}";
			var urlDown="{:U('Index/daoAcrticle')}";
			var urlOrder="{:U('Index/discussOrder')}";
			var urlLoad="{:U('Index/index')}";
			var articleUrl="__URL__";
			var urlImages="__PUBLIC__/images/";
		</script>
		
		<!--<style>
			 *{border: 1px solid rgb(250,0,255);}
			</style>-->
		<style>
		#edit-panel {
			width: 874px;
			max-height: none;
			min-height: 178px;
			overflow: hidden;
			background-color: white;
			border-collapse: separate;
			border: 0px solid rgb(204, 204, 204);
			padding: 4px;
			box-sizing: content-box;
			/*-webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset; 
			box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset;*/
			border-top-right-radius: 3px;
			border-bottom-right-radius: 3px;
			border-bottom-left-radius: 3px;
			border-top-left-radius: 3px;
			outline: none;
		}
		#input-body * {
			font: normal normal 400 14px/20.02px 微软雅黑;
			background-color: #FFF !important;
		}
		#edit-panel img {
			max-width: 700px;
		}
		#edit-panel:focus {
			/* border-color: #66afe9;*/
			outline: 0;
			min-height: 150px;
		}
		#input-head-panel {
			display: none;
		}
		#input-head {
			text-align: center;
			border-bottom: solid 0px #ECECEC;
			border-top: none;
			border-left: none;
			border-right: none;
			width: 874px;
			font: normal normal 400 16px/20.02px 微软雅黑;
		}
		#input-body {
			min-height: 168px;
			font: normal normal 400 14px/20.02px 微软雅黑;
		}
		.card-body img {
			width: 100% !important;
		}
		.toolbutton {
			color: #CECCCC;
		}
		</style>
	</head>
	<body style="background-color:#f8f8f8" background="__PUBLIC__/images/bghw.png">
	<!-- 头部导航开始 --> 
	<include file="Index/title" /> 
	<!-- 主体信息开始 -->
	
	<div id='contents' class="container">
	<div class="hall-toptext">让问题变论题，深度发掘智慧之石</div>
	<div class="hall-toptext" style="font-size:14px">Let the problem becomes the topic, discover more wisdom</div>
	<p>&nbsp;</p>
	<div class="row">
		<div class="col-xs-12">
			<div class="panel panel-default">
				<div class="panel-body" style="padding-bottom:5px;">
					<div class="btn-toolbar exitor-bar" data-role="editor-toolbar" data-target="#input-body" style="border:none;">
						<div id="btn-toolbar" class="btn-group"> <a class="btn" data-edit="bold" title="" data-original-title="加粗 (Ctrl/Cmd+B)"> <i class="fa fa-bold toolbutton"></i> </a> 
							<!--<a class="btn" data-edit="underline" title="" data-original-title="下划线 (Ctrl/Cmd+U)">
						  <i class="fa fa-underline toolbutton"></i>
						</a>
						<a class="btn" data-edit="strikethrough" title="" data-original-title="删除线">
						  <i class="fa fa-strikethrough toolbutton"></i>
						</a>
						<a class="btn" data-edit="insertunorderedlist" title="" data-original-title="无序列表">
						  <i class="fa fa-list-ul toolbutton"></i>
						</a>
						<a class="btn" data-edit="insertorderedlist" title="" data-original-title="有序列表">
						  <i class="fa fa-list-ol toolbutton"></i>
						</a>
						<a class="btn dropdown-toggle" data-toggle="dropdown" title="" data-original-title="添加超链接" style="display:none;">
						  <i class="fa fa-link toolbutton"></i>
						</a>-->
							<div class="dropdown-menu">
								<div class=" input-group">
									<input type="text" class="form-control" placeholder="URL" data-edit="createLink">
									<span class="input-group-btn">
									<button class="btn" type="button">Add</button>
									</span> </div>
							</div>
							<!--<a class="btn" data-edit="unlink" title="" data-original-title="删除超链接" style="display:none;">
						  <i class="fa fa-cut  "></i>
						</a>--> 
							<a class="btn" data-edit="undo" title="撤销 (Ctrl/Cmd+Z)"><i class="fa fa-undo toolbutton"></i></a> <a class="btn" data-edit="redo" title="重做 (Ctrl/Cmd+Y)"><i class="fa fa-repeat toolbutton"></i></a> 
							
							<!--                    <a class="btn" title="" id="pictureBtn" data-original-title="Insert picture (or just drag & drop)">
						  <i class="fa fa-picture-o toolbutton toolbutton"></i>
						</a>
						<input type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" style="opacity: 0; position: absolute; top: 0px; left: 0px; width: 32px; height: 40px;">--> 
						</div>
					</div>
					<div id="edit-panel">
						<div id="input-head-panel">
							<input id="input-head" placeholder="这里输入标题">
						</div>
						<div id="input-body" idt="true" onpaste="clearStyle();" style="color: rgb(153, 153, 153);">有什么疑问，说来听听</div>
						<div id="input-footer" class="input-footer row">
							<div id="discussdiv">
								<div class="col-xs-2" style="color:#4BACC6;">讨论&nbsp;&nbsp;&nbsp;<span style="font-size:12px;font-weight:normal;" id="hintitle">添加标题</span> <!--<a href="#"  id="article" style="color:#cccccc;">文章</a>--> </div>
								<div class="col-xs-8"> 邀请: <span id="appImg"> </span> <span class="fa fa-plus fa fa-large" data-toggle="modal" data-target="#tlyaoqing" id="invite_img"></span> </div>
								<div class="col-xs-2 publish ">发起 <span class="fa fa-external-link fa-lg  release" ></span></div>
							</div>
							<div style="display:none;" id="articlediv">
								<div class="col-xs-2" style="color:#92D050;"><a href="#"  id="discuss" style="color:#cccccc;">讨论</a>&nbsp;&nbsp;&nbsp;文章</div>
								<div class="col-xs-8"> <span style="font-size:12px;font-weight:normal;" id="hintitle">添加标题</span> </div>
								<div class="col-xs-2 publish">发表 <span class="fa fa-external-link fa-lg  release"></span></div>
							</div>
						</div>
					</div>
					<div class="bs-example" style="padding-bottom: 24px;display:none;">
						<button type="button" id="fa-btn" data-loading-text="正在加载..." class="btn btn-primary"> Loading state </button>
					</div>
				</div>
			</div>
		</div>
		<div class="modal fade" id="tlyaoqing" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h3 class="modal-title" id="myModalLabel">邀请<span style="font-weight: lighter;">(最多12人哟)</span></h3>
					</div>
					<div class="modal-body row">
						<h4 class="modal-title">推荐:</h4>
						<foreach name="recommend" item="ui">
							<div class="modal-invite recommend cursor col-md-4"><img src="{$ui['user_img']}" height="45" user_id="{$ui['user_id']}"  class="img-circle"/>{$ui['user_name']}</div>
						</foreach>
						<hr style="width:100%;float:left;margin:5px;">
						<h4 class="modal-title">我关注的:</h4>
						<foreach name="uimg" item="ui">
							<div class="modal-invite cursor col-md-4"><img src="{$ui['user_img']}" height="45" user_id="{$ui['user_id']}"  class="img-circle"/>{$ui['user_name']}</div>
						</foreach>
					</div>
					<div class="modal-footer">
						<button id="invite-sub" type="button" class="btn btn-primary">确认</button>
					</div>
				</div>
				<!-- /.modal-content --> 
			</div>
			<!-- /.modal-dialog --> 
		</div>
		<!-- /.modal --> 
		<script type="text/javascript">
		$(document).ready(function () {
			$("#invite-sub").click(function () {
				$("#appImg").empty();
				var userid = new Array;
				var userimg = new Array;
				var user="";
				var i = 0;
				fuck = ""
				var imgadd;
				$(".modal-invite > .active").each(function () {
					userid[i] = $(this).attr("user_id");
					userimg[i] = $(this).attr("src");
					user +="@"+$(this).attr("user_id");
					i++;
				});
				$('#appImg').attr("value",user);
				for (x in userimg) {
					fuck = '<img src="' + userimg[x] + '" height="30" class="img-circle"/>';
					$(fuck).prependTo('#appImg');
				}
				$('#tlyaoqing').modal('hide');
					
			});
			$(".modal-invite").click(function () {
				if($(".modal-invite > .active").length < 12)
					$(this).children("img").toggleClass("active");
				else
				{
					$(this).children("img").removeClass("active");
					
				}
			});
		});
	</script>
		<div class="row" style="margin-top:30px;">
			<div class="col-xs-6 leftCont" id="appCont">
				<if condition="$messTop['mess_type'] eq 9">
					<div class="card panel panel-default">
						<div class="panel-heading">
							<div class="card-head-left"><a href="{:U('Index/hispage',array('hispage'=>$messTop['user_id']))}"><img src="{$messTop['user_img']}" width="45" class="img-circle" /></a></div>
							<div class="card-head-center"><a href="{:U('Index/hispage',array('hispage'=>$messTop['user_id']))}">{$messTop['user_name']}</a><small>@{$messTop['mess_time']|date='Y-m-d H:i:s',###}</small></div>
							<div class="card-head-right">
								<button type="button" class="close hidden guanbi" data-dismiss="fuck" aria-hidden="true">&times;</button>
							</div>
							<div class="clearfix"></div>
						</div>
						<div class="panel-body fade in">
							<div class="card-body"> 我也很欣赏你的才华，现在我们是好友（互相关注）了~ </div>
						</div>
					</div>
					<elseif condition="$messTop['mess_type'] eq 10"/>
					<div class="card panel panel-default">
						<div class="panel-heading">
							<div class="card-head-left"><a href="{:U('Index/hispage',array('hispage'=>$messTop['user_id']))}"><img src="{$messTop['user_img']}" width="45" class="img-circle" /></a></div>
							<div class="card-head-center"><a href="{:U('Index/hispage',array('hispage'=>$messTop['user_id']))}">{$messTop['user_name']}</a><small>@{$messTop['mess_time']|date='Y-m-d H:i:s',###}</small></div>
							<div class="card-head-right">
								<button type="button" class="close hidden guanbi" data-dismiss="fuck" aria-hidden="true">&times;</button>
							</div>
							<div class="clearfix"></div>
						</div>
						<div class="panel-body fade in">
							<div class="card-body"> 您订阅的讨论，已经完成！请查看<a href="{:U('Index/discuss',array('aId'=>$messTop['article_id']))}"></a> </div>
						</div>
					</div>
				</if>
				<volist name="list" id="vo" mod="2">
					<eq name="mod"  value="0" >
						<div class="card panel panel-default ">
							<div class="panel-body">
								<div class="card-head">
									<div class="card-head-left"><a href="{:U('Index/hispage',array('hispage'=>$vo['user_id']))}"><img src="{$vo['user_img']}" width="45"  class="img-circle"/></a></div>
									<div class="card-head-center"><a href="{:U('Index/hispage',array('hispage'=>$vo['user_id']))}">{$vo['user_name']}</a><small>@{$vo['article_time']}</small></div>
									<if condition="($vo['article_type'] eq 2) or ($vo['article_type'] eq 6)">
										<div class="card-head-right"> <span class="fa fa-eye"> {$vo['article_num']}</span>&nbsp;&nbsp;&nbsp;
											<if condition="$vo['is_order'] eq 1"> <span class="fa fa-rss marking"> {$vo['article_order']}</span>
												<else/>
												<span class="order cursor " value="{$vo['article_id']}"><span class="fa fa-rss "> {$vo['article_order']}</span></span> </if>
										</div>
										<else/>
										<div class="card-head-right"> <span class="fa fa-eye"> {$vo['article_num']}</span>&nbsp;&nbsp;&nbsp;
											<if condition="$vo['article_father_id'] eq 0">
												<if condition="($vo['article_zan_id'] eq 1) or ($vo['article_dao_id'] eq 1)"> <i value="{$vo['article_id']}" class="fa fa-thumbs-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i>
													<else/>
													<i value="{$vo['article_id']}" class="fa fa-thumbs-o-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-o-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i> </if>
												<else/>
												<if condition="($vo['article_zan_id'] eq 1) or ($vo['article_dao_id'] eq 1)"> <i value="{$vo['article_father_id']}" class="fa fa-thumbs-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i>
													<else/>
													<i value="{$vo['article_father_id']}" class="fa fa-thumbs-o-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-o-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i> </if>
											</if>
										</div>
									</if>
									<div class="clearfix"></div>
								</div>
								<div class="card-body">
									<switch name="vo['article_type']">
										<case value="1">
											<div class="title discuss articleTitle"><span class="titleCont"><a  href="{:U('Index/article',array('aid'=>$vo['article_id']))}">{$vo['article_title']}</a></span></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['article_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="2">
											<div class="title discuss articleTitle">发起 <span>讨论</span><span class="titleCont"><a href="{:U('Index/discuss',array('aId'=>$vo['article_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a href="{:U('Index/discuss',array('aId'=>$vo['article_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="3">
											<div class="title discuss articleTitle">参与 <span>讨论</span><span class="titleCont"><a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="4">
											<div class="title discuss articleTitle">赞同 <span class="rss">文章 </span><span class="titleCont"><a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="5">
											<div class="title discuss articleTitle">批阅 <span class="rss">文章 </span><span class="titleCont"><a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="6">
											<div class="title discuss articleTitle">订阅 <span>讨论</span><span class="titleCont"><a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
									</switch>
								</div>
								<div class=""></div>
							</div>
						</div>
					</eq>
				</volist>
			</div>
			<!--php开始RIGHT--> 
			<!--  <div class="col-xs-6  rightCont" id="appCont" >-->
			<div class="col-xs-6  rightCont" >
				<volist name="list" id="vo" mod="2">
					<eq name="mod"  value="1" >
						<div class="card panel panel-default">
							<div class="panel-body">
								<div class="card-head">
									<div class="card-head-left"><a href="{:U('Index/hispage',array('hispage'=>$vo['user_id']))}"><img src="{$vo['user_img']}" width="45" class="img-circle" /></a></div>
									<div class="card-head-center"><a href="{:U('Index/hispage',array('hispage'=>$vo['user_id']))}">{$vo['user_name']}</a><small>@{$vo['article_time']}</small></div>
									<if condition="($vo['article_type'] eq 2) or ($vo['article_type'] eq 3) or($vo['article_type'] eq 6)">
										<div class="card-head-right"> <span class="fa fa-eye"> {$vo['article_num']}</span>&nbsp;&nbsp;&nbsp;
											<if condition="$vo['is_order'] eq 1"> <span class="fa fa-rss marking"> {$vo['article_order']}</span>
												<else/>
												<span class="order cursor " value="{$vo['article_id']}"><span class="fa fa-rss"> {$vo['article_order']}</span></span> </if>
										</div>
										<else/>
										<div class="card-head-right"> <span class="fa fa-eye"> {$vo['article_num']}</span>&nbsp;&nbsp;&nbsp;
											<if condition="$vo['article_father_id'] eq 0">
												<if condition="($vo['article_zan_id'] eq 1) or ($vo['article_dao_id'] eq 1)"> <i value="{$vo['article_id']}" class="fa fa-thumbs-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i>
													<else/>
													<i value="{$vo['article_id']}" class="fa fa-thumbs-o-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-o-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i> </if>
												<else/>
												<if condition="($vo['article_zan_id'] eq 1) or ($vo['article_dao_id'] eq 1)"> <i value="{$vo['article_father_id']}" class="fa fa-thumbs-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i>
													<else/>
													<i value="{$vo[article_father_id]}" class="fa fa-thumbs-o-up good   cursor">{$vo['article_zan']}</i>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-thumbs-o-down   cursor" value="{$vo['article_id']}">{$vo['article_dao']}</i> </if>
											</if>
										</div>
									</if>
									<div class="clearfix"></div>
								</div>
								<div class="card-body">
									<switch name="vo['article_type']">
										<case value="1">
											<div class="title discuss articleTitle"><span class="titleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['article_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['article_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="2">
											<div class="title discuss articleTitle">发起 <span>讨论</span><span class="titleCont"> <a href="{:U('Index/discuss',array('aId'=>$vo['article_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a href="{:U('Index/discuss',array('aId'=>$vo['article_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="3">
											<div class="title discuss articleTitle">参与 <span>讨论</span><span class="titleCont"><a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="4">
											<div class="title discuss articleTitle">赞同 <span class="rss">文章</span><span class="titleCont"><a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="5">
											<div class="title discuss articleTitle">批阅 <span class="rss">文章</span><span class="titleCont"><a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a  href="{:U('Index/article',array('aid'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
										<case value="6">
											<div class="title discuss articleTitle">订阅 <span>讨论 </span><span class="titleCont"><a  href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_title']}</a></span></div>
											<div class="articleCont"> <a href="{:U('Index/discuss',array('aId'=>$vo['father_id']))}">{$vo['article_content']}</a> </div>
										</case>
									</switch>
								</div>
								<div class=""></div>
							</div>
						</div>
					</eq>
				</volist>
			</div>
		</div>
	</div>
	<!-- 主体信息结束 -->
	<div  style="background-color: #f1f2f3; color: #99A9B4; margin:auto; line-height:30px; text-align:center;" class="cursor fildLoad" value="{$max_id}" >点击加载更多</div>
	<footer> </footer>
	<script type="text/javascript">
			$(function(){
				 $('.home').addClass('active');
			$('.hall').removeClass('active');
				$(document).ready(function () {
					var header = new Headroom(document.querySelector(".navbar"), {
						tolerance: 0,
						offset: 0,
						classes: {
							initial: "animated",
							pinned: "slideDown",
							unpinned: "slideUp"
						}
					});
					header.init();
				   
					
				});
				});
				
		//清楚输入框文字格式
		function clearStyle()
		{
			setTimeout("clearStyleDo($('#input-body *'))",20);
		}
		
		function clearStyleDo(box)
		{
			var f = box;
			for(var i = 0;i < f.length;i++){
				try{
					f[i].attributes.class.value="";
					f[i].attributes.style.value="";
				}catch (e)
				{
					try{
						f[i].attributes.style.value="";
					}catch (e)
					{
						continue;
					}
					continue;
				}
			}
		}
	
		function slideUpEditPanel(){
			$("#input-head-panel").slideUp("slow");
			$("#input-head").val("");
			$("#input-body").html("");
			$("#input-footer").slideUp("slow");
			$("#btn-toolbar").slideUp("slow");
		}
		
	  $(document).ready(function(e) {	
	  if(navigator.userAgent.toLowerCase().indexOf('applewebkit') > -1)
		{
			$("#input-body").html(("<span>" + $("#input-body").html() + "</span>"));
		}
		else
		{
			$("#input-body").html("<p>" + $("#input-body").html() + "</p>");
		}
		$("#article").click(function () {
			enableTitle();
			$("#discussdiv").fadeOut("fast",function(){
			$("#articlediv").fadeIn("fast");
			});
		});
		$("#discuss").click(function () {
			enableTitle();
			$("#articlediv").fadeOut("fast",function(){
			$("#discussdiv").fadeIn("fast");
			});
		});
	
		var load = false;
		var title = true;
		$("#input-body").click(function () {
			if(load == false)
			{
				$("#btn-toolbar").height("auto");
				load = true;	
			}
			if($(this).attr("idt") == "true")
			{
				$(this).css("color","#000");
				$(this).text("");
				$(this).attr("idt","false");
			}
			else if($(this).html() == "")
			{
				$(this).css("color","#999");
				$(this).text("有什么疑问，说来听听");
				$(this).attr("idt","true");
			}
			/* $("#input-footer").slideDown("slow");
			$("#btn-toolbar").slideDown("slow");*/    	
		});
		$("#input-body").blur(function(){
			if($(this).text() == "" && $(this).attr("idt") == "false")
			{
				$(this).css("color","#999");
				$(this).text("有什么疑问，说来听听");
				$(this).attr("idt","true");
			}
		});
		$("#input-head").keyup(function(e) {
			if(e.which == 13)
			{
				$("#input-body").focus();
			}
		});
		$("#input-body").click(function(e) {
			$("#input-body").focus();
		});
		$("#input-head").keyup(function(e) {
			if(e.which == 8 && $("#input-head").val() == "")
			{
				removeTitle();
			}
		});
		var once = false;
		$("#input-body").keyup(function(e) {
			if(title == true && e.which == 13)//标题开启，且按键不为BackSpace(8)
			{			
				if($("#input-head").val() != "")
					return;
				var text = getText();
				var FirstLine = "";
				FirstLine = text.substr(0,text.indexOf("\n",0) + 1);
				text = text.substr(text.indexOf("\n",0) + 1);
				if(!fEmpty(text))
					return;
				var i = 0;
				while(FirstLine.charAt(i) == ' ')
				{
					i++;
				}
				for(ha = i;ha <= i + 13;ha++)
				{
					if(FirstLine.charAt(ha) == '\n')
					{
						if(ha == 0)
							return;
						addTitle(FirstLine.substring(i,ha));
						break;
					}
				}
			}else if(e.which == 8)
			{
				var text = getText();
				if(fEmpty(text))
					if(once == false)
						once = true;
					else
					{
						once = false;
						disableTitle();
					}
				else
					once = false;
			}
			else
				once = false;
		});	
		
		$("#hintitle").click(function(e) {
			if($("#hintitle").html() == "删除标题")
			{
				removeTitle();
			}
			else{
				addEmptyTitle();
			}
		});
		
		$("#hintitle1").click(function(e) {
			if($("#hintitle1").html() == "删除标题")
			{
				removeTitle();
			}
			else{
				addEmptyTitle();
			}
		});
	
		function EditorText2String(Html,Space)
		{
			Html = Html.replace(/<br>/g, "");
			Html = Html.replace(/<p>/g, "");
			Html = Html.replace(/<\/p>/g, "");
			Html = Html.replace(/&lt;/g,"<");
			Html = Html.replace(/&gt;/g,">");
			Html = Html.replace(/&amp;/g,"&");
			Html = Html.replace(/&quot;/g,"\"");
			Html = Html.replace(/&reg;/g,"®");
			Html = Html.replace(/&copy;/g,"©");
			if(Space == true)
				Html = Html.replace(/&nbsp;/g,"");
			else
				Html = Html.replace(/&nbsp;/g," ");
			return Html;
		}
		function String2EditorText(Html,Space)
		{		
			Html = Html.replace(/&/g,"&amp;");
			Html = Html.replace(/</g,"&lt;");
			Html = Html.replace(/>/g,"&gt;");
			Html = Html.replace(/"/g,"&quot;");
			Html = Html.replace(/®/g,"&reg;");
			Html = Html.replace(/©/g,"&copy;");
			if(Space == true)
				Html = Html.replace(/ /g,"&nbsp;");
			return Html;
		}
		
		function getText()
		{
			return clearText($("#edit-panel").find("#input-body")[0].innerText) + "\n";
		}
		function getInputBody()
		{
			return $("#edit-panel").find("#input-body")[0];
		}
		
		function clearText(text)
		{
			text = text.replace(/\r\n/g,"\n");
			text = text.replace(/\n\n/g,"\n");
			return text;
		}
		function fEmpty(text){
			text = text.replace(/\n/g,"");
			text = text.replace(/ /g,"");
			if(text == "")
				return true;
			return false;
		}
		function addTitle(text)
		{
			enableTitle();
			$("#input-head").val(text);		
			if(navigator.userAgent.toLowerCase().indexOf("webkit") > -1)
				$("#input-body").html("");
			else
				$("#input-body").html("<p></p>");
			$("#input-head-panel").slideDown("slow");
			$("#input-body").focus();
			$("#hintitle").html("删除标题");
			$("#hintitle1").html("删除标题");
		}
		function addEmptyTitle()
		{
			enableTitle();
			$("#input-head-panel").slideDown("slow");
			$("#hintitle").html("删除标题");
			$("#hintitle1").html("删除标题");
			$("#input-body").focus();
		}
		function removeTitle()
		{
			if(navigator.userAgent.toLowerCase().indexOf("webkit") > -1)
			{
				if($("#input-head").val() != "")
				{
					getInputBody().innerText = $("#input-head").val() + "\n" + getInputBody().innerText;
				}
			}
			else
			{
				if($("#input-head").val() != "")
				{
					$("#input-body").html("<p>" + String2EditorText($("#input-head").val(),true) + "<\p>" + $("#input-body").html());
				}
			}
			$("#input-head").val("");
			$("#input-head-panel").slideUp("slow");
			$("#hintitle").html("添加标题");
			$("#hintitle1").html("添加标题");
			$("#input-body").focus();
		}
		
		function enableTitle()
		{
			title = true;
		}
		
		function disableTitle()
		{
			removeTitle();
			title = false;
			$("#hintitle").html("添加标题");
			$("#hintitle1").html("添加标题");
			$("#input-body").focus();
		}
		
	});
	 
	  $(function(){
		function initToolbarBootstrapBindings() 
		{
	
		  $('a[title]').tooltip({container:'body',placement:'bottom'});
			$('.dropdown-menu input').click(function(){return false;}).change(function () {$(this).parent('.dropdown-menu').siblings('.dropdown-toggle').dropdown('toggle');}).keydown('esc', function () {this.value='';$(this).change();});
	
		  $('[data-role=magic-overlay]').each(function () { 
			var overlay = $(this), target = $(overlay.data('target')); 
			overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());
		  });
		  if ("onwebkitspeechchange"  in document.createElement("input")) {
			var editorOffset = $('#input-body').offset();
			$('#voiceBtn').css('position','absolute').offset({
				top: editorOffset.top, 
				left: editorOffset.left+$('#input-body').innerWidth()
				});
		  } else {
			$('#voiceBtn').hide();
		  }
		};
		function showErrorAlert (reason, detail) {
			var msg='';
			if (reason==='unsupported-file-type') { msg = "Unsupported format " + detail; }
			else {
				console.log("error uploading file", reason, detail);
			}
			$('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button>'+ 
			 '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
		};
		initToolbarBootstrapBindings();  
		$('#input-body').wysiwyg({ fileUploadError: showErrorAlert} );
		window.prettyPrint && prettyPrint();
	
	  });
	</script> 
	<script>
	$(document).ready(function(){
	
	 /*初始化按钮的loading功能，点击后将显示Loading字样，并且按钮被disabled掉，无法连续点击，防止二次提交
	 超过3秒后按钮将恢复原状*/
	 
	$('button[data-loading-text]').click(function () {
		var btn = $(this).button('loading');
		setTimeout(function () {
			btn.button('reset');
		}, 3000);
	});
	  $("#input-body").ajaxSend(function(e,xhr,opt){
		$(this).html("正在请求：" + opt.url);
	  });
	  $("#fat-btn").click(function(){
		alert();
		$("#input-body").load("123.html");
	  });
	});	  
	$(document).ready(function(){
		if($('.leftCont').children().length == 0)
			$('.leftCont').html('<img id="imge" src="__PUBLIC__/images/pen.png">');
	});
		</script> 
	<include file="Index/copyright" />
	</body>
</html>